<!DOCTYPE html>
<html>
<head>
    <title>查询</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">

    <meta name="description" content="Write">
    <link rel="stylesheet" href="../studentPhoneLogin/css/weui.css">
    <link rel="stylesheet" href="https://cdn.bootcss.com/jquery-weui/1.2.0/css/jquery-weui.min.css">
    <link rel="stylesheet" href="../studentPhoneLogin/css/demos.css">
    <link rel="stylesheet" href="https://cdn.bootcss.com/weui/0.4.3/style/weui.min.css" type="text/css">
</head>

<body ontouchstart>
<header class='demos-header' style="padding-top: 20px;padding-bottom: 20px;">
    <h1 class="demos-title">今日课程</h1>
</header>

<div class="weui-form-preview">
    <div class="weui-form-preview__bd">
        <div class="weui-form-preview__item">
            <label class="weui-form-preview__label">选课时间</label>
            <em class="weui-form-preview__value"><?php echo date('Y-m-d H:i:s',$inquireResult[0][5]) ?></em>
        </div>
        <div class="weui-form-preview__item">
            <label class="weui-form-preview__label">教室</label>
            <em class="weui-form-preview__value"><?php echo $inquireResult[0][1] ?></em>
        </div>
        <div class="weui-form-preview__item">
            <label class="weui-form-preview__label">上课时间</label>
            <em class="weui-form-preview__value"><?php echo $inquireResult[0][4] ?></em>
        </div>
        <div class="weui-form-preview__item">
            <label class="weui-form-preview__label">课程内容</label>
            <em class="weui-form-preview__value"><?php echo $inquireResult[0][3] ?></em>
        </div>


        <div class="weui-form-preview__ft">
            <button type="submit" class="weui-form-preview__btn weui-form-preview__btn_primary"
                    onclick="cancel(<?php echo $inquireResult[0][0]; ?>)">取消课程
            </button>
            <button type="submit" class="weui-form-preview__btn weui-form-preview__btn_primary"
                    onclick="historyCourse()">历史课程
            </button>
        </div>
    </div>

    <script src="../studentPhoneLogin/js/jquery-2.1.4.js"></script>
    <script src="../studentPhoneLogin/js/fastclick.js"></script>
    <script>
        $(function () {
            FastClick.attach(document.body);
        });
    </script>

    <script src="https://cdn.bootcss.com/jquery-weui/1.2.0/js/jquery-weui.min.js"></script>
    <script>

        function getCookie(cname) {
            var name = cname + "=";
            var ca = document.cookie.split(';');
            for (var i = 0; i < ca.length; i++) {
                var c = ca[i].trim();
                if (c.indexOf(name) == 0) return c.substring(name.length, c.length);
            }
            return "";
        }


        function cancel(id) {
            var alreadyChoiceCourse = getCookie("alreadyChoiceCourse");
            if (alreadyChoiceCourse == "") {
                $.toast("未选课,禁止操作", "forbidden");
            } else {
                $.confirm({
                    title: '确定取消该课程?',
                    text: '取消无法恢复!',
                    onOK: function () {
                        //点击确认
                        $.post('../studentPhoneLogin/cancelCourse.php', {'id': id}, function (res) {
                            if (res.status == 0) {
                                $.toast(res.msg, "text");
                            } else {
                                $.toast(res.msg, "text");
                                setTimeout(function () {
                                    window.location.href = "alreadyCancelCourse.php";
                                }, 1000);
                            }
                        }, 'json');
                    },
                    onCancel: function () {}
                });
            }
        }

        function historyCourse() {
            setTimeout(function () {
                window.location.href = 'historyCourse.php';
            }, 1000);
        }
    </script>
</body>
</html>
